package StackUse;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        //链式栈 -  双向链表
        //头进头出 尾进尾出

        Deque<Integer> stack = new LinkedList<>();
        stack.push(10);


        //单链表 被当作栈 只能头进头出
    }




    public static void main2(String[] args) {
        MyStack myStack = new MyStack();
        myStack.push(1);
        myStack.push(2);
        myStack.push(3);
        myStack.push(4);
        System.out.println("==========");
        System.out.println(myStack.peek());
        System.out.println(myStack.peek());

        System.out.println(myStack.pop());
        System.out.println(myStack.pop());
        System.out.println(myStack.pop());
        System.out.println(myStack.pop());
        //System.out.println(myStack.pop());
    }


    public static void main1(String[] args) {

        Stack<Integer> stack = new Stack<>();
        stack.push(12);
        stack.push(34);
        stack.push(56);
        stack.push(78);

        //将元素弹出！ 删除栈顶的元素
        int x = stack.pop();
        System.out.println(x);

        //只是获取当前的栈顶元素是什么？
        int x2 = stack.peek();
        System.out.println(x2);

        //判断是否为空
        System.out.println(stack.empty());

        //ArrayDeqeue



    }
}
